﻿// ==============================================================================
// Created by Bndy at 07 / 21 / 2008
// Copyright (c) 2008 Bndy, All rights reserved.
// Welcome to my site http : // www.bndy.net
//
//                    * * * * * * * * * * * * * 
//                    * MAIL- bndy5337@163.com *       http://www.bndy.net
//                    * Q Q - 81795705 =========================================>
//                    * MSN - bndy5337@msn.com *
//                    * * * * * * * * * * * * * 
//
// ------------------------------------------------------------------------------
//
// ==============================================================================

// 浏览器信息
var userAgent = navigator.userAgent.toLowerCase();
var Browser = {
    version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
    isSafari: /webkit/.test(userAgent),
    isOpera: /opera/.test(userAgent),
    isIE: /msie/.test(userAgent) && !/opera/.test(userAgent),
    isMozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
};

// 获取QueryString字符串, 通过GetRequest()['key']调用
function GetRequest() {        
    var url = location.search;  // 获取url中"?"符后的字串  
    var theRequest = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        var strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
        }
    }
    return theRequest;
}

// 创建一个窗口
// window.open("","name","width=100,height=200,toolbar=no,scrollbars=no,menubar=no,screenX=100,screenY=100");
function OpenWindow(url, name, width, height) {
    var top = (window.screen.height - height) / 2 - 50;
    var left = (window.screen.width - width) / 2;
    if (top < 0) top = 0;
    return window.open(url, name, "width=" + width + ",height=" + height + ",left="+ left +", top="+ top +", toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no");
}

function OpenWindow(url, inSelf) {
    if (inSelf) {
        window.location.href = url;
    }
    else {
        window.open(url);
    }
}

// 打开一个模态窗口
function openModalDialog(url, arg, width, height) {
    var top = (window.screen.height - height) / 2 - 50;
    var left = (window.screen.width - width) / 2;
    if (top < 0) top = 0;
    return window.showModalDialog(url, arg, "dialogWidth=" + width + "px;dialogHeight=" + height + "px;dialogLeft=" + left + "px; dialogTop=" + top + "px; status=no; resizable=yes;");
}